# -*- coding: utf-8 -*-

# Scrapy settings for github_login_38 project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     https://docs.scrapy.org/en/latest/topics/settings.html
#     https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#     https://docs.scrapy.org/en/latest/topics/spider-middleware.html

BOT_NAME = 'github_login'

SPIDER_MODULES = ['github_login.spiders']
NEWSPIDER_MODULE = 'github_login.spiders'

# Crawl responsibly by identifying yourself (and your website) on the user-agent
# USER_AGENT = 'github_login_38 (+http://www.yourdomain.com)'

# Obey robots.txt rules
ROBOTSTXT_OBEY = False

# Configure maximum concurrent requests performed by Scrapy (default: 16)
# CONCURRENT_REQUESTS = 32

# Configure a delay for requests for the same website (default: 0)
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
# DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
# CONCURRENT_REQUESTS_PER_DOMAIN = 16
# CONCURRENT_REQUESTS_PER_IP = 16

# Disable cookies (enabled by default)
# COOKIES_ENABLED = False

# Disable Telnet Console (enabled by default)
# TELNETCONSOLE_ENABLED = False

# Override the default request headers:
DEFAULT_REQUEST_HEADERS = {
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Accept-Language': 'en',
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}

# Enable or disable spider middlewares
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
# SPIDER_MIDDLEWARES = {
#    'github_login_38.middlewares.GithubLogin38SpiderMiddleware': 543,
# }

# Enable or disable downloader middlewares
"""
DOWNLOADER_MIDDLEWARES_BASE={
    #框架.下载器中间件.机器人协议.机器人人协议中间件
    "scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware": 100, #机器人协议中间件  认识
    "scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware": 300,#HTTP身份验证中间件   授权中间件   认识
    "scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware": 350,#请求/下载超时中间件      认识
    "scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware": 400,#设置默认请求头中间件     认识
    "scrapy.downloadermiddlewares.useragent.UserAgentMiddleware": 500,#用户代理中间件      认知
    "scrapy.downloadermiddlewares.retry.RetryMiddleware": 550,#重新尝试中间件              认识
    "scrapy.downloadermiddlewares.ajaxcrawl.AjaxCrawlMiddleware": 560,#基于元片段html标签找到“AJAX可抓取”页面变体的中间件   看到
    "scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware": 580,#该中间件基于meta-refresh html标签处理请求的重定向   看到
    "scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware": 590,#该中间件允许从网站发送/接收压缩（gzip，deflate）流量  认识
    "scrapy.downloadermiddlewares.redirect.RedirectMiddleware": 600,#重定向中间件       认识
    "scrapy.downloadermiddlewares.cookies.CookiesMiddleware": 700,#cookie中间件         认识
    "scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware": 750,#代理中间件       认识
    "scrapy.downloadermiddlewares.stats.DownloaderStats": 850,#中间件，用于存储通过它的所有请求，响应和异常的统计信息。 认识
    "scrapy.downloadermiddlewares.httpcache.HttpCacheMiddleware": 900}#缓存中间件                认识
"""

# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
DOWNLOADER_MIDDLEWARES = {
    # 'github_login_38.middlewares.GithubLogin38DownloaderMiddleware': 543,
    # 'github_login.middlewares.MyproxiesDownloaderMiddleware': 123,
    'github_login.middlewares.MiddleUADownloaderMiddleware': 480,
    # 'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware':None,

}

# Enable or disable extensions
# See https://docs.scrapy.org/en/latest/topics/extensions.html
# EXTENSIONS = {
#    'scrapy.extensions.telnet.TelnetConsole': None,
# }

# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# ITEM_PIPELINES = {
#    'github_login_38.pipelines.GithubLogin38Pipeline': 300,
# }

# Enable and configure the AutoThrottle extension (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html
# AUTOTHROTTLE_ENABLED = True
# The initial download delay
# AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
# AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
# AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
# AUTOTHROTTLE_DEBUG = False

# Enable and configure HTTP caching (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
# HTTPCACHE_ENABLED = True
# HTTPCACHE_EXPIRATION_SECS = 0
# HTTPCACHE_DIR = 'httpcache'
# HTTPCACHE_IGNORE_HTTP_CODES = []
# HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'


IPPOOL = [
    {"ipaddr": "61.129.70.131:8080"},
    {"ipaddr": "61.152.81.193:9100"},
    {"ipaddr": "120.204.85.29:3128"},
    {"ipaddr": "219.228.126.86:8123"},
    {"ipaddr": "61.152.81.193:9100"},
    {"ipaddr": "218.82.33.225:53853"},
    {"ipaddr": "223.167.190.17:42789"}
]

user_agent_list = [
    "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 "
    "(KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1",
    "Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 "
    "(KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11",
    "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 "
    "(KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6",
    "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 "
    "(KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6",
    "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.1 "
    "(KHTML, like Gecko) Chrome/19.77.34.5 Safari/537.1",
    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 "
    "(KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5",
    "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.5 "
    "(KHTML, like Gecko) Chrome/19.0.1084.36 Safari/536.5",
    "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3",
    "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3",
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3",
    "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1062.0 Safari/536.3",
    "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1062.0 Safari/536.3",
    "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3",
    "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3",
    "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3",
    "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 "
    "(KHTML, like Gecko) Chrome/19.0.1061.0 Safari/536.3",
    "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.24 "
    "(KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24",
    "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.24 "
    "(KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24"
]
